From 236df30afe34cb599677775d7f75734e0b8edb96 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Wed, 21 Jan 2004 15:52:10 +0000 Subject: [PATCH] fixed bug with &#x handling that caused spurious XML parsing errors. --- gpsbabel/gpx.c | 4 ++-- gpsbabel/util.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index b05518b57..7dff24541 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -822,12 +822,12 @@ gpx_read(void) char *hexit = badchar+3; semi = strchr( badchar, ';' ); if ( semi ) { - *semi = '\0'; - while (*hexit) { + while (*hexit && *hexit != ';') { val *= 16; val += strchr( hex, *hexit )-hex; hexit++; } + if ( val < 32 ) { warning( MYNAME ": Ignoring illegal character %s;\n\tConsider emailing %s at <%s>\n\tabout illegal characters in their GPX files.\n", badchar, gpx_author?gpx_author:"(unknown author)", gpx_email?gpx_email:"(unknown email address)" ); memmove( badchar, semi+1, strlen(semi+1)+1 ); diff --git a/gpsbabel/util.c b/gpsbabel/util.c index e48382e2a..a89f96a4f 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -676,7 +676,7 @@ char * xml_entitize(const char * str) utf8_to_int( cp, &bytes, &value ); cp += bytes-1; - elen += sprintf( tmpsub, "&#%d;", value ) - bytes; + elen += sprintf( tmpsub, "&#x%x;", value ) - bytes; nsecount++; } } @@ -721,7 +721,7 @@ char * xml_entitize(const char * str) else { xstr = NULL; } - sprintf( p, "&#%d;", value ); + sprintf( p, "&#x%x;", value ); p = p+strlen(p); if ( xstr ) { strcpy( p, xstr ); -- 2.30.2